#keystone
mysql -uroot -p{{ ROOT_PASS }} -hlocalhost -e "CREATE DATABASE {{ KEYSTONE_DB_NAME }};"
mysql -uroot -p{{ ROOT_PASS }} -hlocalhost -e "GRANT ALL PRIVILEGES ON {{ KEYSTONE_DB_NAME }}.* TO '{{ KEYSTONE_DB_USER }}'@'localhost' IDENTIFIED BY '{{ KEYSTONE_DB_PASS }}';"
mysql -uroot -p{{ ROOT_PASS }} -hlocalhost -e "GRANT ALL PRIVILEGES ON {{ KEYSTONE_DB_NAME }}.* TO '{{ KEYSTONE_DB_USER }}'@'{{ KEYSTONE_HOST_ALLOW }}' IDENTIFIED BY '{{ KEYSTONE_DB_PASS }}';"

#glance
mysql -uroot -p{{ ROOT_PASS }} -hlocalhost -e "CREATE DATABASE {{ GLANCE_DB_NAME }};"
mysql -uroot -p{{ ROOT_PASS }} -hlocalhost -e "GRANT ALL PRIVILEGES ON {{ GLANCE_DB_NAME }}.* TO '{{ GLANCE_DB_USER }}'@'localhost' IDENTIFIED BY '{{ GLANCE_DB_PASS }}';"
mysql -uroot -p{{ ROOT_PASS }} -hlocalhost -e "GRANT ALL PRIVILEGES ON {{ GLANCE_DB_NAME }}.* TO '{{ GLANCE_DB_USER }}'@'{{ GLANCE_HOST_ALLOW }}' IDENTIFIED BY '{{ GLANCE_DB_PASS }}';"

#nova
mysql -uroot -p{{ ROOT_PASS }} -hlocalhost -e "CREATE DATABASE {{ NOVA_DB_NAME }};"
mysql -uroot -p{{ ROOT_PASS }} -hlocalhost -e "GRANT ALL PRIVILEGES ON {{ NOVA_DB_NAME }}.* TO '{{ NOVA_DB_USER }}'@'localhost' IDENTIFIED BY '{{ NOVA_DB_PASS }}';"
mysql -uroot -p{{ ROOT_PASS }} -hlocalhost -e "GRANT ALL PRIVILEGES ON {{ NOVA_DB_NAME }}.* TO '{{ NOVA_DB_USER }}'@'{{ NOVA_HOST_ALLOW }}' IDENTIFIED BY '{{ NOVA_DB_PASS }}';"

mysql -uroot -p{{ ROOT_PASS }} -hlocalhost -e "CREATE DATABASE {{ NOVA_API_DB_NAME }};"
mysql -uroot -p{{ ROOT_PASS }} -hlocalhost -e "GRANT ALL PRIVILEGES ON {{ NOVA_API_DB_NAME }}.* TO '{{ NOVA_DB_USER }}'@'localhost' IDENTIFIED BY '{{ NOVA_DB_PASS }}';"
mysql -uroot -p{{ ROOT_PASS }} -hlocalhost -e "GRANT ALL PRIVILEGES ON {{ NOVA_API_DB_NAME }}.* TO '{{ NOVA_DB_USER }}'@'{{ NOVA_HOST_ALLOW }}' IDENTIFIED BY '{{ NOVA_DB_PASS }}';"

mysql -uroot -p{{ ROOT_PASS }} -hlocalhost -e "CREATE DATABASE {{ NOVA_CELL0_DB_NAME }};"
mysql -uroot -p{{ ROOT_PASS }} -hlocalhost -e "GRANT ALL PRIVILEGES ON {{ NOVA_CELL0_DB_NAME }}.* TO '{{ NOVA_DB_USER }}'@'localhost' IDENTIFIED BY '{{ NOVA_DB_PASS }}';"
mysql -uroot -p{{ ROOT_PASS }} -hlocalhost -e "GRANT ALL PRIVILEGES ON {{ NOVA_CELL0_DB_NAME }}.* TO '{{ NOVA_DB_USER }}'@'{{ NOVA_HOST_ALLOW }}' IDENTIFIED BY '{{ NOVA_DB_PASS }}';"

#neutron
mysql -uroot -p{{ ROOT_PASS }} -hlocalhost -e "CREATE DATABASE {{ NEUTRON_DB_NAME }};"
mysql -uroot -p{{ ROOT_PASS }} -hlocalhost -e "GRANT ALL PRIVILEGES ON {{ NEUTRON_DB_NAME }}.* TO '{{ NEUTRON_DB_USER }}'@'localhost' IDENTIFIED BY '{{ NEUTRON_DB_PASS }}';"
mysql -uroot -p{{ ROOT_PASS }} -hlocalhost -e "GRANT ALL PRIVILEGES ON {{ NEUTRON_DB_NAME }}.* TO '{{ NEUTRON_DB_USER }}'@'{{ NEUTRON_HOST_ALLOW }}' IDENTIFIED BY '{{ NEUTRON_DB_PASS }}';"

#cinder
mysql -uroot -p{{ ROOT_PASS }} -hlocalhost -e "CREATE DATABASE {{ CINDER_DB_NAME }};"
mysql -uroot -p{{ ROOT_PASS }} -hlocalhost -e "GRANT ALL PRIVILEGES ON {{ CINDER_DB_NAME }}.* TO '{{ CINDER_DB_USER }}'@'localhost' IDENTIFIED BY '{{ CINDER_DB_PASS }}';"
mysql -uroot -p{{ ROOT_PASS }} -hlocalhost -e "GRANT ALL PRIVILEGES ON {{ CINDER_DB_NAME }}.* TO '{{ CINDER_DB_USER }}'@'{{ CINDER_HOST_ALLOW }}' IDENTIFIED BY '{{ CINDER_DB_PASS }}';"

#flush privileges
mysql -uroot -p{{ ROOT_PASS }} -hlocalhost -e "FLUSH PRIVILEGES;"
